import { NgModule } from '@angular/core';
import { Routes, RouterModule } from '@angular/router';
import { NavigationComponent } from "./navigation.component";
import { AuthGuard } from "../../service/guard/auth.guard";
import { CanDeactivateGuard } from "../../service/guard/can-deactivate.guard";
import { MainComponent } from '../monitor/main/main.component';
import { MainWinfarmComponent } from '../monitor/main/main-winfarm/main-winfarm.component';

const routes: Routes = [
  {
    path: '',
    component: NavigationComponent,
    canActivate: [AuthGuard],
    canActivateChild: [AuthGuard],
    children: [
      {
        path: 'performance',
        canDeactivate: [CanDeactivateGuard],
        loadChildren: '../performance/performance.module#PerformanceModule',
      },
      { path: 'monitor/main', component: MainComponent },
      { path: 'monitor/mainWinfarm', component: MainWinfarmComponent },
      {
        path: 'monitor/windenergy',
        canDeactivate: [CanDeactivateGuard],
        loadChildren: '../monitor/wind-energy/wind-energy.module#WindEnergyModule',
      },
      {
        path: 'monitor',
        canDeactivate: [CanDeactivateGuard],
        loadChildren: '../monitor/monitor.module#MonitorModule',
        data: { preload: true }
      },
      {
        path: 'admin',
        canDeactivate: [CanDeactivateGuard],
        loadChildren: '../admin/admin.module#AdminModule',
      },
      {
        path: 'dataanalysis',
        canDeactivate: [CanDeactivateGuard],
        loadChildren: '../data-analysis/data-analysis.module#DataAnalysisModule',
      },
      {
        path: 'basic',
        canDeactivate: [CanDeactivateGuard],
        loadChildren: '../basic/basic.module#BasicModule',
      },
      {
        path: 'alarm',
        canDeactivate: [CanDeactivateGuard],
        loadChildren: '../alarm/alarm.module#AlarmModule',
      },
      {
        path: 'report',
        canDeactivate: [CanDeactivateGuard],
        loadChildren: '../report/report.module#ReportModule',
      },
      {
        path: 'dynamicreport',
        canDeactivate: [CanDeactivateGuard],
        loadChildren: '../dynamic-report/dynamic-report.module#DynamicReportModule',
      },
    ]
  }
];

@NgModule({
  imports: [RouterModule.forChild(routes)],
  exports: [RouterModule]
})
export class NavigationRoutingModule { }



// WEBPACK FOOTER //
// ./src/app/module/navigation/navigation-routing.module.ts